import request from '@/utils/request'

/**
 * 获取用户列表数据
 */
export const getUserManageList = data => {
  return request({
    url: '/user/list',
    params: data
  })
}
/**
 * 获取用户列表数据
 */
export const addUser = data => {
  return request({
    url: '/user/add',
    method:"POST",
    data: data
  })
}
/**
 * 批量导入
 */
export const userBatchImport = data => {
  return request({
    url: '/user-manage/batch/import',
    method: 'POST',
    data
  })
}



/**
 * 获取所有用户列表数据
 */
export const getUserManageAllList = () => {
  return request({
    url: '/user-manage/all-list'
  })
}

/**
 * 获取用户详情
 */
export const userDetail = id => {
  return request({
    url: `/user/detail/${id}`
  })
}

/**
 * 获取指定用户角色
 */
export const userRoles = id => {
  return request({
    url: `/user/role/${id}`
  })
}

export const getInfo=(userId)=>{
  return request({
    url: `/user/info/${userId}`,
    method:'GET'
  })
}
/**
 * 分用户分配角色
 */
export const editUser = (data) => {
  return request({
    url: `/user/edit`,
    method: 'POST',
    data: data
  })
}
/**
 * 分用户分配角色
 */
export const deleteUser = (data) => {
  return request({
    url: `/user/remove`,
    method: 'DELETE',
    data: data
  })
}
/**
 * 分用户分配角色
 */
export const updateRole = (id, roles) => {
  return request({
    url: `/user/update-role/${id}`,
    method: 'POST',
    data: {
      roles
    }
  })
}
